package com.gupaoedu.pattern.sigleton.register;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Auther: tcm
 * @Date: 2020/1/23 21:43
 * @Description:
 */
public class RegisterSingleton {

    private static Map<String, RegisterSingleton> objMap = new ConcurrentHashMap<>();

    public synchronized static RegisterSingleton getInstance(String name){

        if(!objMap.containsKey(name)){
            objMap.put(name, new RegisterSingleton());
        }

        return (RegisterSingleton) objMap.get(name);
    }

}
